﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LibNiconico.NiconicoApi.Internal;
using LibNiconico.NiconicoApi.Extentions;

namespace LibNiconico.NiconicoApi.Lives.Comments.PostKey
{
    /// <summary>
    /// ニコニコ生放送ポストキー取得レスポンス
    /// </summary>
    public sealed class NicoLiveGetPostkeyResponse 
    {
        private NicoLiveGetPostkeyResponse(QueryStrings querys)  { }
        
        /// <summary>
        /// ポストキー
        /// </summary>
        public string PostKey { get; internal set; }

        internal static NicoLiveGetPostkeyResponse Parse(QueryStrings querys)
        {
            NicoLiveGetPostkeyResponse res = new NicoLiveGetPostkeyResponse(querys);
            res.PostKey = (from query in querys
                           where query.Key == "postkey"
                           select query.Value).First() ?? "";

            return res;
        }
    }
}
